﻿var time = "";
var times = "";
function timeService() {
    var t = new Date();
    var y = t.getFullYear();
    var m = t.getMonth() + 1;
    var d = t.getDate();
    var h = t.getHours();
    var min = t.getMinutes();
    var s = t.getSeconds();
    var day = t.getDay();
    if (m < 10) { m = 0 + "" + m; };
    if (d < 10) { d = 0 + "" + d; };
    if (h < 10) { h = 0 + "" + h; };
    if (min < 10) { min = 0 + "" + min; };
    if (s < 10) { s = 0 + "" + s; };
    if (day == 0) { day = "星期天" };
    if (day == 1) { day = "星期一" };
    if (day == 2) { day = "星期二" };
    if (day == 3) { day = "星期三" };
    if (day == 4) { day = "星期四" };
    if (day == 5) { day = "星期五" };
    if (day == 6) { day = "星期六" };  
    if (time == times)
    {
           time = "服务器时间：" + y + "年" + m + "月" + d + "日 " + h + ":" + min + ":" + s + "  " + day; 	
    }
    else {
                                       //FF
        time = "服务器时间：" + y + "年" + m + "月" + d + "日 " + h + " " + min + " " + s + "  " + day;
        times = time;
    }
    document.getElementById("timeText").innerHTML = time;
    setTimeout("timeService()", 500);
}